Skip to main content

All Questions

Tagged with
2votes
2answers
181views

Improved input validation function

A week ago I posted this question and after reading the answers and accepting one I decided to refactor my code quite heavily. I would like to get some feedback on this newer version. The changes No ...
globalturist's user avatar
2votes
3answers
200views

Making an input validator function

NOTICE: I refactored the code and made a new question like was advised. I'm making an input validator function that is inspired by @JDługosz from the following post so that other new C++ programmers ...
globalturist's user avatar
4votes
3answers
514views

Input validation of a signed double (in C++)

I am a beginner, who is just learning the language (C++) from C++ Primer. I have been trying to build a side pico-project by writing functions for validation of user input for an signed double. The ...
SogaBan's user avatar
1vote
1answer
133views

Advent of Code 2020 - Day 2: validating passwords (C++ version)

Original: Advent of Code 2020 - Day 2: validating passwords Problem statement I decided to translate my Rust solution to Advent of Code 2020 into C++ to increase my familiarity with C++. Here's the ...
L. F.'s user avatar
  • 9,625
7votes
2answers
1kviews

Simple username validation

This checks if a given username is valid, before doing any database lookups. (I know it's possibly better to use regular expressions, but I wanted to be able to give specific errors.) I'm curious if ...
CaptainCodeman's user avatar
3votes
2answers
83views

C++ PixelComponent struct

Hey I wrote a struct in C++ trying to represent a Pixel Component of a color Here it is ...
Hrant Nurijanyan's user avatar
-2votes
1answer
81views

Validate Search Binary Tree [closed]

I was looking to this exercise: Is Valid Binary Search Tree I tried to do the exercise by myself without looking to the solution and my code is "much simpler" than the code I found at the ...
a.dibacco's user avatar
7votes
1answer
587views

Infix to postfix conversion in C++

Here is a program for conversion of an infix expression to a postfix expression using a stack. I would like to know how I could improve my checking for invalid input, make my code more expressive, and ...
DS2830's user avatar
10votes
4answers
3kviews

Validator for mathematical expression in infix form

This program will validate whether a mathematical expression entered by the user is a valid expression based off whether the expression itself has been entered with the correct scope openers and scope ...
Zachariah's user avatar
4votes
1answer
497views

Define a class for latitude and longitude in C++ using boost::units and spheroidal coordinates

I am trying to write a class that defines latitude and longitude in C++ using boost::units and normalized spheroidal coordinates. I want to throw an exception if ...
nimble_ninja's user avatar
2votes
3answers
4kviews

Integer validation in C++

I am studying C++ and after I learned about some functions of the library cctype like isdigit I decided to make a program that ...
Xam's user avatar
  • 365
23votes
6answers
15kviews

Validating Yes/No answers in C++

I intend to accept all of the following answers: y Y yes YES Yes plus mixtures, such as yeS, yES, which I didn't intend to accept but it's a consequence of my code the same applies to No and its ...
Vlastimil Burián's user avatar
6votes
3answers
769views

Insertion sort with high OOP and error processing

The input file contains data of one of two types: integers or strings. Data recorded in the column (each line of the file is a new element). Strings can contain any non-whitespace characters. The ...
Михаил Хамхоев's user avatar
18votes
7answers
20kviews

Checking if each char in a string is a decimal digit

I had to write a program that would verify that a string contains any digits beside numbers 0-9 and the first '-' sign to indicate if pos/neg. The algorithm works like I want it to, but is there a ...
rchkrvr2's user avatar
6votes
3answers
3kviews

User input validation that might be unbreakable for C++

I am new to programming and have been having a lot of trouble with user input validation. Everything I found online I could break and I finally put this function together that appears to be ...
takintoolong's user avatar

153050per page
close